#ifndef KINGDOM_H
#define KINGDOM_H
#include "Object.h"

class sgGeneral;
class CMapTile;
class sgCity;
class sgArmy;

typedef std::map<int, sgGeneral*> GeneralMap;
typedef std::map<int, sgCity*> CityMap;
typedef std::map<int, CMapTile*> ProvinceMap;
typedef std::map<int, sgArmy*> ArmyMap;
class sgKingdom:public sgObject
{
public:
    sgKingdom( );
    ~sgKingdom( );
    virtual void Serialize( CSerialize& s );
    void Update( int diff );
    void Render();
    void SetKing( sgGeneral *king );
    sgGeneral *GetKing( );
    int GetColor( );
    void SetColor( int color );
    void SetName( const std::string &name );
    std::string &GetName( );
    GeneralMap &GetGenerals( );
    void AddGeneral( sgGeneral *g );
    sgGeneral *GetGeneral( int id );
    void RemoveGeneral( int id );

    void AddArmy( sgArmy *a );
    sgArmy *GetArmy( int id );
    ArmyMap &GetArmies( );
    
    void AddCity( sgCity *c );
    sgCity *GetCity( int id );
    CityMap &GetCities( );

    void SetCapital( sgCity *c );
    sgCity *GetCapital( );
    static sgObject *Creator( );
    static bool m_creatorRegisted;
protected:
    sgGeneral *m_king;
    GeneralMap m_generals;
    CityMap m_cities;
    ProvinceMap m_provinces;
    ArmyMap m_armies;
    int m_color;
    std::string m_name;
    sgCity *m_capital;
};

#endif